#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include "fcntl.h"

struct lcdMsg
{
    char key[128];
    char value[128];
};

struct lcdMsg lcdmsg;


int main(int argc, char *argv[])
{
    printf("bxlcdparamIO!\n");

    sprintf(lcdmsg.key, "%s", "width");
    sprintf(lcdmsg.value, "%s", "128");


    char buf[512] = {0};
    int fd;
    fd = open("/dev/bxlcdparam", O_RDWR);
    if (fd < 0)
    {
        perror("open error");
        return fd;
    }

    printf("lcdmsg is %s,%s\n", lcdmsg.key,lcdmsg.value);
    // write(fd, "1111", sizeof("1111"));
    write(fd,&lcdmsg,sizeof(lcdmsg));
    // read(fd, buf, sizeof(buf));

    // sleep(1);
    // printf("buf: %s\n", buf);

    close(fd);

    return 0;
}